<?php
class UserModel{	
	public static function getUserByID($id=null){
		$__q_user_object = "SELECT * FROM ".USERS." WHERE id = '{$id}'";
		return tools::__adodb('getRow',$__q_user_object);
	}
	
	public static function getUserByUseName($username=null){
		$__q_user_object = "SELECT * FROM ".USERS." WHERE nazwa_uzytkownika = ".tools::__mres($username);
		return tools::__adodb('getRow',$__q_user_object);
	}
	public static function getUserByUseEmail($email=null){
		$__q_user_object = "SELECT * FROM ".USERS." WHERE email = ".tools::__mres($email);
		return tools::__adodb('getRow',$__q_user_object);
	}	
	protected  function setUserData($col, $val ){
		$q = "UPDATE ".USERS." SET $col = '$val' WHERE nazwa_uzytkownika = '$this->nazwa_uzytkownika'";
		return tools::__adodb('exec',$q);
	}
	public static function getUserByStanowisko($stanowisko=null){
		$__q_user_object = "SELECT * FROM ".USERS." WHERE stanowisko = ".tools::__mres($stanowisko)." LIMIT 1";
		return tools::__adodb('getRow',$__q_user_object);
	}	
	

}